package dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import entity.BookInfo;

@Dao
public interface BookDao {
    @Insert
    void insert(BookInfo...book);//可变参数
    @Delete
    void delete(BookInfo...book);
    @Query("delete from BookInfo")//删除所有信息
    void deleteAll();
    @Update
    void uodate(BookInfo...book);
    //加载所有书籍信息
    @Query("select * from BookInfo")
    List<BookInfo> queryAll();
    //根据名字加载书籍
    @Query("select * from BookInfo where name = :name order by id desc limit 1")
    BookInfo queryByName(String name);
}
